from google.appengine.api import users
from google.appengine.ext.webapp import template
import os

def ensure_login(handler):
  user = users.get_current_user()
  if not user:
    handler.redirect(users.create_login_url(handler.request.uri))
  else:
    return user

def render_template(handler, template_filename, template_values):
  path = os.path.join(os.path.dirname(__file__), 'templates', template_filename)
  handler.response.out.write(template.render(path, template_values))

if __name__ == "__main__":
  print "This module contains only utility methods"

